package com.hp.bon.sgw.wh.channel.outside.bizSlotOutQuery.utils;

import com.hp.bon.logreverse.ExtractHelper;
import com.hp.bon.sgw.bean.XmlMessage;
import org.dom4j.Element;

public class XmlMessageUtils {

    public static String getLatnId(XmlMessage xmlMessage) {
        Element dataElement = xmlMessage.getDataElement();
        String value = ExtractHelper.getXmlNodeValue(dataElement, "/Service_Information/Latn_Id");
        if (value == null) {
            value = "";
        }
        return value;
    }

    public static String getRegionId(XmlMessage xmlMessage) {
        Element dataElement = xmlMessage.getDataElement();
        String value = ExtractHelper.getXmlNodeValue(dataElement, "/Service_Information/REGION_ID");
        if (value == null) {
            value = "";
        }
        return value;
    }

    public static String getAreaCode(XmlMessage xmlMessage) {
        Element dataElement = xmlMessage.getDataElement();
        String value = ExtractHelper.getXmlNodeValue(dataElement, "/Service_Information/Area_Code");
        if (value == null) {
            value = "";
        }
        return value;
    }

    public static String getAREACODE(XmlMessage xmlMessage) {
        Element dataElement = xmlMessage.getDataElement();
        String value = ExtractHelper.getXmlNodeValue(dataElement, "/Service_Information/AREA_CODE");
        if (value == null) {
            value = "";
        }
        return value;
    }

    public static String getCapability(XmlMessage xmlMessage) {
        String scid = xmlMessage.getSCID();
        String capability = scid.substring(0, scid.indexOf('@'));
        return capability;
    }

}
